package com.hcinfos.gsoo.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelper extends SQLiteOpenHelper {
	private static final String DBNAME = "gsoo.db";
	private static final int VERSION = 1;
	private static final String TABLE_CITY = "CREATE TABLE IF NOT EXISTS "
			+ " city (_id integer primary key autoincrement,cityName varchar(100), "
			+ " aphaIndex varchar(4),cityId varchar(512))";
	private static final String TABLE_IMG_CACHE = "CREATE TABLE IF NOT EXISTS "
			+ " imageCache (_id integer primary key autoincrement,time_stamp TimeStamp, "
			+ " past_time TimeStamp,url text)";

	public DBHelper(Context context) {
		super(context, DBNAME, null, VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(TABLE_CITY);
		db.execSQL(TABLE_IMG_CACHE);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL(TABLE_CITY);
		onCreate(db);
	}
}
